<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java IO流体系详解</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .text-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            font-weight: 700;
            color: #667eea;
        }
        .section-divider {
            height: 2px;
            background: linear-gradient(to right, transparent, #667eea, transparent);
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center animate-fadeInUp">
            <h1 class="text-5xl md:text-6xl font-bold mb-6">
                <i class="fas fa-stream mr-4"></i>Java IO流体系
            </h1>
            <p class="text-xl md:text-2xl font-light mb-8 opacity-90">
                深入理解输入输出流的分类与应用
            </p>
            <div class="flex justify-center space-x-6 text-lg">
                <span><i class="fas fa-exchange-alt mr-2"></i>双向数据流</span>
                <span><i class="fas fa-layer-group mr-2"></i>多层架构</span>
                <span><i class="fas fa-code mr-2"></i>灵活扩展</span>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-7xl mx-auto px-6 py-12">
        
        <!-- 流的分类概述 -->
        <section class="mb-16 animate-fadeInUp">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <h2 class="text-3xl font-bold mb-8 text-gray-800">
                    <i class="fas fa-sitemap mr-3 text-purple-600"></i>IO流的三维分类体系
                </h2>
                
                <div class="grid md:grid-cols-3 gap-6 mb-10">
                    <div class="card-hover bg-gradient-to-br from-blue-50 to-blue-100 rounded-xl p-6">
                        <div class="text-blue-600 text-4xl mb-4">
                            <i class="fas fa-arrows-alt-h"></i>
                        </div>
                        <h3 class="text-xl font-semibold mb-3 text-gray-800">按数据方向分类</h3>
                        <p class="text-gray-600 leading-relaxed">
                            <span class="font-medium">输入流：</span>从数据源读取数据到程序<br>
                            <span class="font-medium">输出流：</span>从程序写入数据到目标位置
                        </p>
                    </div>
                    
                    <div class="card-hover bg-gradient-to-br from-green-50 to-green-100 rounded-xl p-6">
                        <div class="text-green-600 text-4xl mb-4">
                            <i class="fas fa-microchip"></i>
                        </div>
                        <h3 class="text-xl font-semibold mb-3 text-gray-800">按处理单位分类</h3>
                        <p class="text-gray-600 leading-relaxed">
                            <span class="font-medium">字节流：</span>以字节为单位，处理二进制数据<br>
                            <span class="font-medium">字符流：</span>以字符为单位，处理文本数据
                        </p>
                    </div>
                    
                    <div class="card-hover bg-gradient-to-br from-purple-50 to-purple-100 rounded-xl p-6">
                        <div class="text-purple-600 text-4xl mb-4">
                            <i class="fas fa-network-wired"></i>
                        </div>
                        <h3 class="text-xl font-semibold mb-3 text-gray-800">按功能分类</h3>
                        <p class="text-gray-600 leading-relaxed">
                            <span class="font-medium">节点流：</span>直接连接数据源的基础流<br>
                            <span class="font-medium">处理流：</span>包装节点流，提供增强功能
                        </p>
                    </div>
                </div>

                <!-- 可视化关系图 -->
                <div class="bg-gray-50 rounded-xl p-6 mt-8">
                    <h3 class="text-xl font-semibold mb-4 text-center text-gray-800">IO流分类关系图</h3>
                    <div class="mermaid">
                        graph TD
                            A[Java IO流] --> B[按方向分类]
                            A --> C[按单位分类]
                            A --> D[按功能分类]
                            
                            B --> B1[输入流]
                            B --> B2[输出流]
                            
                            C --> C1[字节流]
                            C --> C2[字符流]
                            
                            D --> D1[节点流]
                            D --> D2[处理流]
                            
                            style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                            style B fill:#4c9aff,stroke:#fff,stroke-width:2px,color:#fff
                            style C fill:#36d399,stroke:#fff,stroke-width:2px,color:#fff
                            style D fill:#f472b6,stroke:#fff,stroke-width:2px,color:#fff
                    </div>
                </div>
            </div>
        </section>

        <!-- 四大抽象类 -->
        <section class="mb-16 animate-fadeInUp">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <h2 class="text-3xl font-bold mb-8 text-gray-800">
                    <i class="fas fa-cube mr-3 text-purple-600"></i>四大抽象基类
                </h2>
                
                <div class="overflow-hidden rounded-xl shadow-lg">
                    <table class="w-full">
                        <thead class="bg-gradient-to-r from-purple-600 to-purple-700 text-white">
                            <tr>
                                <th class="px-6 py-4 text-left font-semibold">流类型</th>
                                <th class="px-6 py-4 text-left font-semibold">字节流</th>
                                <th class="px-6 py-4 text-left font-semibold">字符流</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr class="bg-gray-50 hover:bg-gray-100 transition-colors">
                                <td class="px-6 py-4 font-medium text-gray-800">
                                    <i class="fas fa-download mr-2 text-blue-500"></i>输入流
                                </td>
                                <td class="px-6 py-4">
                                    <code class="bg-blue-100 text-blue-800 px-2 py-1 rounded">InputStream</code>
                                </td>
                                <td class="px-6 py-4">
                                    <code class="bg-green-100 text-green-800 px-2 py-1 rounded">Reader</code>
                                </td>
                            </tr>
                            <tr class="hover:bg-gray-100 transition-colors">
                                <td class="px-6 py-4 font-medium text-gray-800">
                                    <i class="fas fa-upload mr-2 text-orange-500"></i>输出流
                                </td>
                                <td class="px-6 py-4">
                                    <code class="bg-blue-100 text-blue-800 px-2 py-1 rounded">OutputStream</code>
                                </td>
                                <td class="px-6 py-4">
                                    <code class="bg-green-100 text-green-800 px-2 py-1 rounded">Writer</code>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>

                <!-- 抽象类继承关系图 -->
                <div class="mt-8 bg-gray-50 rounded-xl p-6">
                    <h3 class="text-xl font-semibold mb-4 text-center text-gray-800">抽象类继承体系</h3>
                    <div class="mermaid">
                        graph TB
                            subgraph 字节流
                                IS[InputStream] --> FIS[FileInputStream]
                                IS --> BIS[BufferedInputStream]
                                IS --> DIS[DataInputStream]
                                
                                OS[OutputStream] --> FOS[FileOutputStream]
                                OS --> BOS[BufferedOutputStream]
                                OS --> DOS[DataOutputStream]
                            end
                            
                            subgraph 字符流
                                R[Reader] --> FR[FileReader]
                                R --> BR[BufferedReader]
                                R --> ISR[InputStreamReader]
                                
                                W[Writer] --> FW[FileWriter]
                                W --> BW[BufferedWriter]
                                W --> OSW[OutputStreamWriter]
                            end
                            
                            style IS fill:#4c9aff,stroke:#fff,stroke-width:2px,color:#fff
                            style OS fill:#4c9aff,stroke:#fff,stroke-width:2px,color:#fff
                            style R fill:#36d399,stroke:#fff,stroke-width:2px,color:#fff
                            style W fill:#36d399,stroke:#fff,stroke-width:2px,color:#fff
                    </div>
                </div>
            </div>
        </section>

        <!-- 节点流与处理流 -->
        <section class="mb-16 animate-fadeInUp">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <h2 class="text-3xl font-bold mb-8 text-gray-800">
                    <i class="fas fa-project-diagram mr-3 text-purple-600"></i>节点流与处理流
                </h2>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div class="bg-gradient-to-br from-blue-50 to-indigo-100 rounded-xl p-6">
                        <h3 class="text-2xl font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-dot-circle mr-3 text-blue-600"></i>节点流
                        </h3>
                        <p class="text-gray-700 leading-relaxed drop-cap">
                            节点流是直接与数据源相连的流，它们可以从一个特定的数据源（如文件、内存、网络等）读写数据。节点流是IO操作的基础，提供了最基本的读写功能。
                        </p>
                        <div class="mt-4 space-y-2">
                            <div class="flex items-center text-gray-600">
                                <i class="fas fa-check-circle mr-2 text-green-500"></i>
                                <span>直接操作数据源</span>
                            </div>
                            <div class="flex items-center text-gray-600">
                                <i class="fas fa-check-circle mr-2 text-green-500"></i>
                                <span>构造时需要指定数据源</span>
                            </div>
                            <div class="flex items-center text-gray-600">
                                <i class="fas fa-check-circle mr-2 text-green-500"></i>
                                <span>基础IO功能实现</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-gradient-to-br from-purple-50 to-pink-100 rounded-xl p-6">
                        <h3 class="text-2xl font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-layer-group mr-3 text-purple-600"></i>处理流
                        </h3>
                        <p class="text-gray-700 leading-relaxed drop-cap">
                            处理流是对已存在的流（节点流或其他处理流）进行包装，通过对数据的处理为程序提供更为强大的读写功能。处理流使用装饰器模式，可以动态地增加功能。
                        </p>
                        <div class="mt-4 space-y-2">
                